<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
  xmlns:c="livcos.org/ns/cosmos"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="c f">
  
  <xsl:import href="./style/meta_content.xsl"/>
  <xsl:import href="./style/view.xsl"/>
  
  <xsl:variable name="view" select="'meta'"/>
  <xsl:param name="scope" select="'cosmos'"/>
  
  <xsl:template match="/*">
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link href="{$toDomainPath}/web/css/styles.css" rel="stylesheet" type="text/css" />
        <link href="{$toDomainPath}/web/css/webXml.css" rel="stylesheet" type="text/css" />
        <xsl:call-template name="page_scripts"/>
      </head>
      <body>
        <div id="{f:object-id(.)}.{$scope}" class="contentPanel" style="background-color: white;">
          <div class="content">
            <p style="margin-left: 0px;">
              <span style="font-variant: small-caps;">Raw Data for </span>
              <xsl:value-of select="$absRef"/>
            </p>
            <xsl:apply-imports/>
          </div>
        </div>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template name="page_scripts">
  	<script type="text/javascript" src="{$toDomainPath}/web/script/util.js"><!-- --></script>
  	<script type="text/javascript" src="{$toDomainPath}/web/script/E.js"><!-- --></script>
    <script type="text/javascript" src="{$toDomainPath}/web/script/init.js"><!-- --></script>
  </xsl:template>
  
  <xsl:template name="printDefaultNS">
    <xsl:param name="id"/>
    <xsl:if test="(namespace-uri-for-prefix('', .) = '') and (. != root()) and (namespace-uri-for-prefix('', ..) != '')">
      <xsl:call-template name="printNS">
        <xsl:with-param name="id" select="$id"/>
        <xsl:with-param name="prefix" select="''"/>
        <xsl:with-param name="nsUri" select="''"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  
  <xsl:template match="xsl:import/@href" mode="attr_val">
    <xsl:variable name="uri" select="substring-after(resolve-uri(., base-uri()), 'cosmos:')"/>
    <a class="attrVal" href="{$view}?ref={substring-before($uri, '.xsl')}"><xsl:value-of select="." /></a>
  </xsl:template>
  
</xsl:stylesheet>